//
//  RegisterViewController.m
//  DA_V
//
//  Created by 周季阳 on 15/4/22.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "RegisterViewController.h"
#import "InterFace.h"
#import "UIViewAdditions.h"
#import "UserProtocolViewController.h"
@interface RegisterViewController ()<UITextFieldDelegate>

@end

@implementation RegisterViewController
@synthesize zPassword,zInfoLabel,zPhoneNum,zRegistrationNow,zUserProtocolBtn,zVerifyPassword,zWeChatBtn;

#pragma mark - viewDidLoad
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [self colorWithHexString:@"#F5F5F5"];
    
    [self initUI];
    
    UITapGestureRecognizer *loginGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(loginGesturese)];
    [self.view addGestureRecognizer:loginGesture];
    
}
-(void)loginGesturese{
    [zPhoneNum resignFirstResponder];
    [zPassword resignFirstResponder];
    [zVerifyPassword resignFirstResponder];
}
#pragma mark - initUI
-(void)initUI{
    UIImageView *loginPwdBG = [[UIImageView alloc] initWithFrame:CGRectMake(0.0625*SCREEN_WIDTH,100, SCREEN_WIDTH*0.875, SCREEN_WIDTH*0.36)];
    loginPwdBG.image = [UIImage imageNamed:@"liner"];
    loginPwdBG.backgroundColor = [UIColor clearColor];
    loginPwdBG.userInteractionEnabled = YES;
    [self.view addSubview:loginPwdBG];
    
    
    zPhoneNum = [[UITextField alloc] initWithFrame:CGRectMake(30, 0,loginPwdBG.frame.size.width-60 , loginPwdBG.frame.size.height/3)];
    zPhoneNum.placeholder = @"手机号";
    [loginPwdBG addSubview:zPhoneNum];
    zPhoneNum.font = [UIFont systemFontOfSize:14];
    zPhoneNum.delegate = self;
    
    
    //    UIImageView *loginPwdBG1 = [[UIImageView alloc] initWithFrame:CGRectMake(20,loginPwdBG.bottom, SCREEN_WIDTH-40, SCREEN_HEIGHT*0.07)];
    //    //loginPwdBG1.image = [UIImage imageNamed:@"zhuce_06"];
    //    loginPwdBG1.backgroundColor = [UIColor whiteColor];
    //    loginPwdBG1.userInteractionEnabled = YES;
    //    [self.view addSubview:loginPwdBG1];
    
    
    zPassword = [[UITextField alloc] initWithFrame:CGRectMake(30, zPhoneNum.bottom,loginPwdBG.frame.size.width-60 ,loginPwdBG.frame.size.height/3)];
    zPassword.placeholder = @"密码";
    zPassword.delegate = self;
    zPassword.font = [UIFont systemFontOfSize:14];
    zPassword.secureTextEntry = YES;
    [loginPwdBG addSubview:zPassword];
    
    
    zVerifyPassword = [[UITextField alloc] initWithFrame:CGRectMake(30, zPassword.bottom,loginPwdBG.frame.size.width-60,loginPwdBG.frame.size.height/3)];
    zVerifyPassword.placeholder = @"确认密码";
    zVerifyPassword.delegate = self;
    zVerifyPassword.secureTextEntry = YES;
    zVerifyPassword.font = [UIFont systemFontOfSize:14];
    [loginPwdBG addSubview:zVerifyPassword];
    
    UILabel *infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(0.0625*SCREEN_WIDTH,loginPwdBG.bottom+10, 104, 20)];
    infoLabel.text = @"点击注册表示同意";
    infoLabel.font = [UIFont systemFontOfSize:13];
    infoLabel.textAlignment = NSTextAlignmentLeft;
    infoLabel.textColor = [UIColor blackColor];
    [self.view addSubview:infoLabel];
    
    zUserProtocolBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    zUserProtocolBtn.frame = CGRectMake(infoLabel.right, loginPwdBG.bottom+10, 60, 20);
    [zUserProtocolBtn setTitle:@"用户协议" forState:UIControlStateNormal];
    [zUserProtocolBtn setTitleColor:[self colorWithHexString:@"#52A3DD"] forState:UIControlStateNormal];
    zUserProtocolBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    [zUserProtocolBtn addTarget:self action:@selector(clickUserProtocol) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:zUserProtocolBtn];
    
    UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    loginBtn.frame = CGRectMake(SCREEN_WIDTH-0.0625*SCREEN_WIDTH-28, loginPwdBG.bottom+10, 28, 20);
    [loginBtn setTitle:@"登录" forState:UIControlStateNormal];
    [loginBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [loginBtn addTarget:self action:@selector(clickLoginBtn) forControlEvents:UIControlEventTouchUpInside];
    loginBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.view addSubview:loginBtn];
    
    zRegistrationNow = [UIButton buttonWithType:UIButtonTypeCustom];
    zRegistrationNow.frame = CGRectMake(0.0625*SCREEN_WIDTH, zUserProtocolBtn.bottom+30, SCREEN_WIDTH*0.875, SCREEN_WIDTH*0.125);
    [zRegistrationNow setBackgroundImage:[UIImage imageNamed:@"registern"] forState:UIControlStateNormal];
    [zRegistrationNow setBackgroundImage:[UIImage imageNamed:@"registern1"] forState:UIControlStateHighlighted];
    [zRegistrationNow addTarget:self action:@selector(clickRegistration) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:zRegistrationNow];
    
    UIImageView *speedLogin = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"action_04"]];
    speedLogin.frame = CGRectMake(0, zRegistrationNow.bottom+50, SCREEN_WIDTH, 14);
    [self.view addSubview:speedLogin];
    
    zWeChatBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    zWeChatBtn.frame = CGRectMake(115, speedLogin.bottom+20, 90, 90);
    [zWeChatBtn setBackgroundImage:[self circleImage:[UIImage imageNamed:@"action_08"] withParam:0] forState:UIControlStateNormal];
    [zWeChatBtn addTarget:self action:@selector(clickWeChatBtn) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:zWeChatBtn];
    
}

#pragma mark - 用户协议
-(void)clickUserProtocol{
    UserProtocolViewController *user = [[UserProtocolViewController alloc]init];
    [self.navigationController pushViewController:user animated:YES];
}
#pragma mark - 登录
-(void)clickLoginBtn{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -立即注册
-(void)clickRegistration{
    
}
#pragma mark - 微信登录
-(void)clickWeChatBtn{
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
